namespace SmartSoft.Invoices
{
    using SmartSoft;
    using SmartSoft.Controls;
    using SmartSoft.Controls.ChildGridControls;
    using SmartSoft.ADP;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormCTYCEditor : FormEditor
    {
        private IContainer components;
        private GridDetail grdDetail;
        private LabelControl lblDesc_EN;
        private LabelControl lblDia_Chi;
        private LabelControl lblDien_Giai;
        private LabelControl lblGhi_Chu;
        private LabelControl lblMa_Dt;
        private CTKHODataAccess oMethod;
        private TextControl txtDesc_EN;
        private TextControl txtDia_Chi;
        private TextControl txtDien_Giai;
        private TextControl txtGhi_Chu;
        private TextSearch txtMa_Dt;
        private TextControl txtTen_Dt;
        private TextControl txtTen_CvX;
        private TextSearch txtMa_CvX;
        private LabelControl lblMa_Cv;
        private TextControl txtTen_CvN;
        private TextSearch txtMa_CvN;
        private LabelControl lblMa_CvN;
        private TextControl txtTen_DtN;
        private TextSearch txtMa_DtN;
        private LabelControl lblMa_DtN;
        private LabelControl lblMo_Ta;
        private TextControl txtMo_Ta;
        private TextControl txtHien_Trang;
        private LabelControl lblHien_Trang;
        private LabelControl lblIs_Stop0;
        private TextOption txtHinh_Thuc;
        private TextControl txtTen_Kt;
        private TextSearch txtMa_Kt;
        private LabelControl lblMa_Kt;
        private LabelControl lblNgay_Ht;
        public TextDate txtNgay_Ht;
        private SearchColumn Column3;
        private DataGridViewTextBoxColumn Column4;
        private DataGridViewTextBoxColumn So_Hieu;
        private SearchColumn Column9;
        private DataGridViewTextBoxColumn Column10;
        private OptionColumn Column11;
        private DataGridViewTextBoxColumn Column23;
        private NumericColumn Column22;
        private LabelControl lblIs_Stop;

        public FormCTYCEditor()
        {
            this.oMethod = new CTKHODataAccess();
            this.InitializeComponent();
            base.DetailGridBrowser.CellEnter += new DataGridViewCellEventHandler(this.DetailGridBrowser_CellEnter);
            base.DetailGridBrowser.CellEndEdit += new DataGridViewCellEventHandler(this.DetailGridBrowser_CellEndEdit);
            base.ResizeForm();
        }

        public FormCTYCEditor(SSInvoiceLib po_SSInvoiceLib) : base(po_SSInvoiceLib)
        {
            this.oMethod = new CTKHODataAccess();
            this.InitializeComponent();
            base.InvoiceCode = po_SSInvoiceLib.InvoiceCode;
            base.DetailGridBrowser.CellEnter += new DataGridViewCellEventHandler(this.DetailGridBrowser_CellEnter);
            base.DetailGridBrowser.CellEndEdit += new DataGridViewCellEventHandler(this.DetailGridBrowser_CellEndEdit);
            base.ResizeForm();
        }

        public FormCTYCEditor(string ps_InvoiceCode, string ps_MasterInvoiceOrder) : base(ps_InvoiceCode, ps_MasterInvoiceOrder)
        {
            this.oMethod = new CTKHODataAccess();
            this.InitializeComponent();
            base.InvoiceCode = ps_InvoiceCode;
            base.DetailGridBrowser.CellEnter += new DataGridViewCellEventHandler(this.DetailGridBrowser_CellEnter);
            base.DetailGridBrowser.CellEndEdit += new DataGridViewCellEventHandler(this.DetailGridBrowser_CellEndEdit);
            base.LocalMasterRow = this.oMethod.GetMasterDataRow(base.SavedMasterOrder);
            base.LocalDetailDataSet = this.oMethod.GetDetailDataSet(base.SavedMasterOrder);
            this.OnShow();
            base.ResizeForm();
        }

        private bool AddNewRow(bool pb_Inserted)
        {
            if ((base.DetailGridBrowser.CurrentRow == null) || (base.DetailGridBrowser.CurrentRow.DataBoundItem == null))
            {
                return false;
            }
            DataRow row = ((DataRowView) base.DetailGridBrowser.CurrentRow.DataBoundItem).Row;
            if ((((decimal) row["So_Luong9"]) == 0M) && (((decimal) row["So_Luong"]) == 0M))
            {
                return false;
            }
            int num = 0;
            if (pb_Inserted)
            {
                num = (int) row["Stt_Nv"];
                foreach (DataRow row2 in base.LocalDetailTable.Rows)
                {
                    if ((row2.RowState != DataRowState.Deleted) && (((int) row2["Stt_Nv"]) > num))
                    {
                        row2["Stt_Nv"] = ((int) row2["Stt_Nv"]) + 1;
                    }
                }
            }
            else
            {
                foreach (DataRow row3 in base.LocalDetailTable.Rows)
                {
                    if ((row3.RowState != DataRowState.Deleted) && (((int) row3["Stt_Nv"]) > num))
                    {
                        num = (int) row3["Stt_Nv"];
                    }
                }
                if (((int) row["Stt_Nv"]) < num)
                {
                    return false;
                }
            }
            object obj2 = row["Ma_Kho"];
            base.DetailGridBrowser.EndEdit();
            DataRow row4 = base.MakeDetailRow();
            int key = num + 1;
            row4["Stt_Nv"] = key;
            row4["He_So9"] = 1;
            row4["Ma_Kho"] = obj2;
            row4["So_Luong9"] = 0;
            row4["So_Luong"] = 0;
            row4["H_Luong"] = 0;
            row4["Do_Am_PT"] = 0;
            row4["Do_Con_PT"] = 0;
            base.LocalDetailTable.Rows.Add(row4);
            BindingSource dataSource = base.DetailGridBrowser.DataSource as BindingSource;
            dataSource.Position = dataSource.Find(base.DetailOrderString, key);
            return true;
        }

        private void Calculate()
        {
            DataRow row = ((DataRowView) this.grdDetail.CurrentRow.DataBoundItem).Row;
            row["So_Luong"] = decimal.Round(((decimal) row["So_Luong9"]) * ((decimal) row["He_So9"]), base.QuantityDecimals);
        }

        private void DetailGridBrowser_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                this.SetItemRatio();
            }
            else if (e.ColumnIndex == 2)
            {
                this.SetItemRatio();
            }
            else if (e.ColumnIndex == 12)
            {
                this.Calculate();
            }
        }

        private void DetailGridBrowser_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
            //if (e.ColumnIndex == 2)
            //{
            //    this.SetItemUnits();
            //}
            //else if (e.ColumnIndex == 5)
            //{
            //    object obj2 = ((base.SSInvoiceParameters.InvoiceCode == "PWDC") && !string.IsNullOrEmpty(this.txtMa_KhoN.Text)) ? this.txtMa_KhoN.Value : SDBNull.Value;
            //    DataRow row = ((DataRowView) base.DetailGridBrowser.CurrentRow.DataBoundItem).Row;
            //    (base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).InvoicePosted = base.LocalMasterRow["Posted"];
            //    (base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).InvoiceDate = (DateTime) base.txtNgay_Ct.Value;
            //    (base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).MasterKey = base.SavedMasterOrder;
            //    (base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).DetailKey = base.SavedDetailOrder;
            //    (base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).InventoryCode = row["Ma_Kho"];
            //    (base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).InventoryInputCode = obj2;
            //    (base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).RackNumber = row["Ma_Ke"];
            //    (base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).LocalItemCode = row["Ma_Vt"];
            //    (base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).LocalDetailTable = base.LocalDetailTable;
            //}            
            if (e.ColumnIndex == 4)
            {
                this.SetItemUnits();
            }
            else if (e.ColumnIndex == 7)
            {
                //object obj2 = ((base.SSInvoiceParameters.InvoiceCode == "PWDC") && !string.IsNullOrEmpty(this.txtMa_KhoN.Text)) ? this.txtMa_KhoN.Value : SDBNull.Value;
                //DataRow row = ((DataRowView) base.DetailGridBrowser.CurrentRow.DataBoundItem).Row;
                //(base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).InvoicePosted = base.LocalMasterRow["Posted"];
                //(base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).InvoiceDate = (DateTime) base.txtNgay_Ct.Value;
                //(base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).MasterKey = base.SavedMasterOrder;
                //(base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).DetailKey = base.SavedDetailOrder;
                //(base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).InventoryCode = row["Ma_Kho"];
                //(base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).InventoryInputCode = obj2;
                //(base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).RackNumber = row["Ma_Ke"];
                //(base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).LocalItemCode = row["Ma_Vt"];
                //(base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).LocalDetailTable = base.LocalDetailTable;
            }


        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void grdDetail_CellBottomLeftLeaved(object sender, EventArgs e)
        {
            if (((base.DetailGridBrowser.Rows.Count == 1) || !string.IsNullOrEmpty(((DataRowView) base.DetailGridBrowser.CurrentRow.DataBoundItem).Row["Ma_Vt"].ToString())) || !string.IsNullOrEmpty(base.ActiveControl.Text))
            {
                (base.DetailGridBrowser as GridDetail).UserMoveNextCell = GridDetail.MoveNextType.NextCell;
            }
            else
            {
                this.txtMo_Ta.Focus();
                (base.DetailGridBrowser as GridDetail).UserMoveNextCell = GridDetail.MoveNextType.DeleteCurrentRow;
            }
        }

        private void grdDetail_CellRightLeaved(object sender, EventArgs e)
        {
            if (this.AddNewRow(false))
            {
                (base.DetailGridBrowser as GridDetail).UserMoveNextCell = GridDetail.MoveNextType.FirstCell;
            }
            else
            {
                (base.DetailGridBrowser as GridDetail).UserMoveNextCell = GridDetail.MoveNextType.FirstCellNextRow;
            }
        }

        private void InitializeComponent()
        {
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
            this.txtDesc_EN = new SmartSoft.Controls.TextControl();
            this.txtDien_Giai = new SmartSoft.Controls.TextControl();
            this.lblDesc_EN = new SmartSoft.Controls.LabelControl();
            this.lblDien_Giai = new SmartSoft.Controls.LabelControl();
            this.txtDia_Chi = new SmartSoft.Controls.TextControl();
            this.txtTen_Dt = new SmartSoft.Controls.TextControl();
            this.txtMa_Dt = new SmartSoft.Controls.TextSearch();
            this.lblDia_Chi = new SmartSoft.Controls.LabelControl();
            this.lblMa_Dt = new SmartSoft.Controls.LabelControl();
            this.grdDetail = new SmartSoft.Controls.GridDetail();
            this.lblGhi_Chu = new SmartSoft.Controls.LabelControl();
            this.txtGhi_Chu = new SmartSoft.Controls.TextControl();
            this.txtTen_CvX = new SmartSoft.Controls.TextControl();
            this.txtMa_CvX = new SmartSoft.Controls.TextSearch();
            this.lblMa_Cv = new SmartSoft.Controls.LabelControl();
            this.txtTen_CvN = new SmartSoft.Controls.TextControl();
            this.txtMa_CvN = new SmartSoft.Controls.TextSearch();
            this.lblMa_CvN = new SmartSoft.Controls.LabelControl();
            this.txtTen_DtN = new SmartSoft.Controls.TextControl();
            this.txtMa_DtN = new SmartSoft.Controls.TextSearch();
            this.lblMa_DtN = new SmartSoft.Controls.LabelControl();
            this.lblMo_Ta = new SmartSoft.Controls.LabelControl();
            this.txtMo_Ta = new SmartSoft.Controls.TextControl();
            this.txtHien_Trang = new SmartSoft.Controls.TextControl();
            this.lblHien_Trang = new SmartSoft.Controls.LabelControl();
            this.lblIs_Stop0 = new SmartSoft.Controls.LabelControl();
            this.txtHinh_Thuc = new SmartSoft.Controls.TextOption();
            this.lblIs_Stop = new SmartSoft.Controls.LabelControl();
            this.txtTen_Kt = new SmartSoft.Controls.TextControl();
            this.txtMa_Kt = new SmartSoft.Controls.TextSearch();
            this.lblMa_Kt = new SmartSoft.Controls.LabelControl();
            this.lblNgay_Ht = new SmartSoft.Controls.LabelControl();
            this.txtNgay_Ht = new SmartSoft.Controls.TextDate();
            this.Column3 = new SmartSoft.Controls.ChildGridControls.SearchColumn();
            this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.So_Hieu = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column9 = new SmartSoft.Controls.ChildGridControls.SearchColumn();
            this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column11 = new SmartSoft.Controls.ChildGridControls.OptionColumn();
            this.Column23 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column22 = new SmartSoft.Controls.ChildGridControls.NumericColumn();
            ((System.ComponentModel.ISupportInitialize)(this.grdDetail)).BeginInit();
            this.SuspendLayout();
            // 
            // txtMa_Loai1
            // 
            this.txtMa_Loai1.TabIndex = 25;
            // 
            // txtMa_Loai2
            // 
            this.txtMa_Loai2.TabIndex = 26;
            // 
            // txtMa_Loai3
            // 
            this.txtMa_Loai3.TabIndex = 27;
            // 
            // txtSo_Ct
            // 
            this.txtSo_Ct.TabIndex = 2;
            // 
            // txtDesc_EN
            // 
            this.txtDesc_EN.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.txtDesc_EN.CheckTextSearched = false;
            this.txtDesc_EN.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtDesc_EN.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtDesc_EN.Location = new System.Drawing.Point(486, 118);
            this.txtDesc_EN.MaxLength = 254;
            this.txtDesc_EN.Name = "txtDesc_EN";
            this.txtDesc_EN.OldValue = null;
            this.txtDesc_EN.Size = new System.Drawing.Size(295, 20);
            this.txtDesc_EN.TabIndex = 12;
            this.txtDesc_EN.UserTextLength = SmartSoft.AppInstance.TextControlLength.InvoiceDescription;
            this.txtDesc_EN.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtDesc_EN.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            // 
            // txtDien_Giai
            // 
            this.txtDien_Giai.CheckTextSearched = false;
            this.txtDien_Giai.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtDien_Giai.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtDien_Giai.Location = new System.Drawing.Point(100, 119);
            this.txtDien_Giai.MaxLength = 254;
            this.txtDien_Giai.Name = "txtDien_Giai";
            this.txtDien_Giai.OldValue = null;
            this.txtDien_Giai.Size = new System.Drawing.Size(296, 20);
            this.txtDien_Giai.TabIndex = 11;
            this.txtDien_Giai.UserTextLength = SmartSoft.AppInstance.TextControlLength.InvoiceDescription;
            this.txtDien_Giai.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtDien_Giai.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            // 
            // lblDesc_EN
            // 
            this.lblDesc_EN.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.lblDesc_EN.AutoSize = true;
            this.lblDesc_EN.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblDesc_EN.Location = new System.Drawing.Point(409, 121);
            this.lblDesc_EN.Name = "lblDesc_EN";
            this.lblDesc_EN.Size = new System.Drawing.Size(71, 14);
            this.lblDesc_EN.TabIndex = 80;
            this.lblDesc_EN.Text = "Diễn giải (EN)";
            // 
            // lblDien_Giai
            // 
            this.lblDien_Giai.AutoSize = true;
            this.lblDien_Giai.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblDien_Giai.Location = new System.Drawing.Point(13, 122);
            this.lblDien_Giai.Name = "lblDien_Giai";
            this.lblDien_Giai.Size = new System.Drawing.Size(73, 14);
            this.lblDien_Giai.TabIndex = 81;
            this.lblDien_Giai.Text = "Diễn giải (VN)";
            // 
            // txtDia_Chi
            // 
            this.txtDia_Chi.CheckTextSearched = false;
            this.txtDia_Chi.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtDia_Chi.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtDia_Chi.Location = new System.Drawing.Point(100, 97);
            this.txtDia_Chi.MaxLength = 128;
            this.txtDia_Chi.Name = "txtDia_Chi";
            this.txtDia_Chi.OldValue = null;
            this.txtDia_Chi.Size = new System.Drawing.Size(295, 20);
            this.txtDia_Chi.TabIndex = 10;
            this.txtDia_Chi.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemDescription;
            this.txtDia_Chi.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtDia_Chi.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            // 
            // txtTen_Dt
            // 
            this.txtTen_Dt.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Dt.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_Dt.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Dt.CheckTextSearched = false;
            this.txtTen_Dt.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Dt.Enabled = false;
            this.txtTen_Dt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Dt.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Dt.Location = new System.Drawing.Point(223, 79);
            this.txtTen_Dt.Name = "txtTen_Dt";
            this.txtTen_Dt.OldValue = null;
            this.txtTen_Dt.Size = new System.Drawing.Size(172, 13);
            this.txtTen_Dt.TabIndex = 7;
            this.txtTen_Dt.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtTen_Dt.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Dt.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            // 
            // txtMa_Dt
            // 
            this.txtMa_Dt.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Dt.CheckTextSearched = false;
            this.txtMa_Dt.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Dt.FieldDisplay = "Ten_Dt";
            this.txtMa_Dt.FirstFilter = "Is_Stop = \'1\'";
            this.txtMa_Dt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Dt.Location = new System.Drawing.Point(100, 75);
            this.txtMa_Dt.MaxLength = 32;
            this.txtMa_Dt.Name = "txtMa_Dt";
            this.txtMa_Dt.OldValue = null;
            this.txtMa_Dt.Size = new System.Drawing.Size(118, 20);
            this.txtMa_Dt.TabIndex = 6;
            this.txtMa_Dt.TableName = "DMDT";
            this.txtMa_Dt.TextDisplay = this.txtTen_Dt;
            this.txtMa_Dt.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Dt.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Dt.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            this.txtMa_Dt.Validated += new System.EventHandler(this.txtMa_Dt_Validated);
            // 
            // lblDia_Chi
            // 
            this.lblDia_Chi.AutoSize = true;
            this.lblDia_Chi.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblDia_Chi.Location = new System.Drawing.Point(13, 100);
            this.lblDia_Chi.Name = "lblDia_Chi";
            this.lblDia_Chi.Size = new System.Drawing.Size(40, 14);
            this.lblDia_Chi.TabIndex = 95;
            this.lblDia_Chi.Text = "Địa chỉ";
            // 
            // lblMa_Dt
            // 
            this.lblMa_Dt.AutoSize = true;
            this.lblMa_Dt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Dt.Location = new System.Drawing.Point(13, 78);
            this.lblMa_Dt.Name = "lblMa_Dt";
            this.lblMa_Dt.Size = new System.Drawing.Size(78, 14);
            this.lblMa_Dt.TabIndex = 94;
            this.lblMa_Dt.Text = "Người yêu cầu";
            // 
            // grdDetail
            // 
            this.grdDetail.AllowUserToAddRows = false;
            this.grdDetail.AllowUserToDeleteRows = false;
            this.grdDetail.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.grdDetail.CheckAutoSize = true;
            this.grdDetail.CheckColor = false;
            this.grdDetail.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.grdDetail.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.Column3,
            this.Column4,
            this.So_Hieu,
            this.Column9,
            this.Column10,
            this.Column11,
            this.Column23,
            this.Column22});
            this.grdDetail.Font = new System.Drawing.Font("Arial", 8.25F);
            this.grdDetail.Location = new System.Drawing.Point(0, 141);
            this.grdDetail.Name = "grdDetail";
            this.grdDetail.Size = new System.Drawing.Size(794, 111);
            this.grdDetail.TabIndex = 13;
            this.grdDetail.CellRightLeaved += new System.EventHandler(this.grdDetail_CellRightLeaved);
            this.grdDetail.CellBottomLeftLeaved += new System.EventHandler(this.grdDetail_CellBottomLeftLeaved);
            // 
            // lblGhi_Chu
            // 
            this.lblGhi_Chu.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.lblGhi_Chu.AutoSize = true;
            this.lblGhi_Chu.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblGhi_Chu.Location = new System.Drawing.Point(12, 468);
            this.lblGhi_Chu.Name = "lblGhi_Chu";
            this.lblGhi_Chu.Size = new System.Drawing.Size(44, 14);
            this.lblGhi_Chu.TabIndex = 81;
            this.lblGhi_Chu.Text = "Ghi chú";
            // 
            // txtGhi_Chu
            // 
            this.txtGhi_Chu.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtGhi_Chu.CheckTextSearched = false;
            this.txtGhi_Chu.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtGhi_Chu.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtGhi_Chu.Location = new System.Drawing.Point(99, 465);
            this.txtGhi_Chu.MaxLength = 254;
            this.txtGhi_Chu.Name = "txtGhi_Chu";
            this.txtGhi_Chu.OldValue = null;
            this.txtGhi_Chu.Size = new System.Drawing.Size(683, 20);
            this.txtGhi_Chu.TabIndex = 24;
            this.txtGhi_Chu.UserTextLength = SmartSoft.AppInstance.TextControlLength.InvoiceDescription;
            this.txtGhi_Chu.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtGhi_Chu.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            // 
            // txtTen_CvX
            // 
            this.txtTen_CvX.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_CvX.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_CvX.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_CvX.CheckTextSearched = false;
            this.txtTen_CvX.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_CvX.Enabled = false;
            this.txtTen_CvX.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_CvX.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_CvX.Location = new System.Drawing.Point(610, 79);
            this.txtTen_CvX.Name = "txtTen_CvX";
            this.txtTen_CvX.OldValue = null;
            this.txtTen_CvX.Size = new System.Drawing.Size(172, 13);
            this.txtTen_CvX.TabIndex = 9;
            this.txtTen_CvX.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtTen_CvX.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_CvX.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            // 
            // txtMa_CvX
            // 
            this.txtMa_CvX.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_CvX.CheckTextSearched = false;
            this.txtMa_CvX.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_CvX.EmptyIsValid = true;
            this.txtMa_CvX.FieldDisplay = "Ten_Cv";
            this.txtMa_CvX.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_CvX.Location = new System.Drawing.Point(486, 75);
            this.txtMa_CvX.MaxLength = 32;
            this.txtMa_CvX.Name = "txtMa_CvX";
            this.txtMa_CvX.OldValue = null;
            this.txtMa_CvX.Size = new System.Drawing.Size(118, 20);
            this.txtMa_CvX.TabIndex = 8;
            this.txtMa_CvX.TableName = "DMCV";
            this.txtMa_CvX.TextDisplay = this.txtTen_CvX;
            this.txtMa_CvX.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_CvX.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_CvX.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            // 
            // lblMa_Cv
            // 
            this.lblMa_Cv.AutoSize = true;
            this.lblMa_Cv.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Cv.Location = new System.Drawing.Point(409, 78);
            this.lblMa_Cv.Name = "lblMa_Cv";
            this.lblMa_Cv.Size = new System.Drawing.Size(48, 14);
            this.lblMa_Cv.TabIndex = 104;
            this.lblMa_Cv.Text = "Chức vụ";
            // 
            // txtTen_CvN
            // 
            this.txtTen_CvN.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_CvN.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_CvN.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_CvN.CheckTextSearched = false;
            this.txtTen_CvN.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_CvN.Enabled = false;
            this.txtTen_CvN.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_CvN.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_CvN.Location = new System.Drawing.Point(609, 403);
            this.txtTen_CvN.Name = "txtTen_CvN";
            this.txtTen_CvN.OldValue = null;
            this.txtTen_CvN.Size = new System.Drawing.Size(172, 13);
            this.txtTen_CvN.TabIndex = 19;
            this.txtTen_CvN.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtTen_CvN.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_CvN.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            // 
            // txtMa_CvN
            // 
            this.txtMa_CvN.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_CvN.CheckTextSearched = false;
            this.txtMa_CvN.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_CvN.EmptyIsValid = true;
            this.txtMa_CvN.FieldDisplay = "Ten_Cv";
            this.txtMa_CvN.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_CvN.Location = new System.Drawing.Point(486, 399);
            this.txtMa_CvN.MaxLength = 32;
            this.txtMa_CvN.Name = "txtMa_CvN";
            this.txtMa_CvN.OldValue = null;
            this.txtMa_CvN.Size = new System.Drawing.Size(118, 20);
            this.txtMa_CvN.TabIndex = 18;
            this.txtMa_CvN.TableName = "DMCV";
            this.txtMa_CvN.TextDisplay = this.txtTen_CvN;
            this.txtMa_CvN.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_CvN.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_CvN.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            // 
            // lblMa_CvN
            // 
            this.lblMa_CvN.AutoSize = true;
            this.lblMa_CvN.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_CvN.Location = new System.Drawing.Point(409, 402);
            this.lblMa_CvN.Name = "lblMa_CvN";
            this.lblMa_CvN.Size = new System.Drawing.Size(48, 14);
            this.lblMa_CvN.TabIndex = 115;
            this.lblMa_CvN.Text = "Chức vụ";
            // 
            // txtTen_DtN
            // 
            this.txtTen_DtN.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_DtN.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_DtN.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_DtN.CheckTextSearched = false;
            this.txtTen_DtN.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_DtN.Enabled = false;
            this.txtTen_DtN.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_DtN.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_DtN.Location = new System.Drawing.Point(223, 402);
            this.txtTen_DtN.Name = "txtTen_DtN";
            this.txtTen_DtN.OldValue = null;
            this.txtTen_DtN.Size = new System.Drawing.Size(172, 13);
            this.txtTen_DtN.TabIndex = 17;
            this.txtTen_DtN.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtTen_DtN.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_DtN.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            // 
            // txtMa_DtN
            // 
            this.txtMa_DtN.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_DtN.CheckTextSearched = false;
            this.txtMa_DtN.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_DtN.EmptyIsValid = true;
            this.txtMa_DtN.FieldDisplay = "Ten_Dt";
            this.txtMa_DtN.FirstFilter = "Is_Stop = \'1\'";
            this.txtMa_DtN.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_DtN.Location = new System.Drawing.Point(99, 399);
            this.txtMa_DtN.MaxLength = 32;
            this.txtMa_DtN.Name = "txtMa_DtN";
            this.txtMa_DtN.OldValue = null;
            this.txtMa_DtN.Size = new System.Drawing.Size(118, 20);
            this.txtMa_DtN.TabIndex = 16;
            this.txtMa_DtN.TableName = "DMDT";
            this.txtMa_DtN.TextDisplay = this.txtTen_DtN;
            this.txtMa_DtN.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_DtN.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_DtN.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            // 
            // lblMa_DtN
            // 
            this.lblMa_DtN.AutoSize = true;
            this.lblMa_DtN.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_DtN.Location = new System.Drawing.Point(12, 401);
            this.lblMa_DtN.Name = "lblMa_DtN";
            this.lblMa_DtN.Size = new System.Drawing.Size(63, 14);
            this.lblMa_DtN.TabIndex = 108;
            this.lblMa_DtN.Text = "Người nhận";
            // 
            // lblMo_Ta
            // 
            this.lblMo_Ta.AutoSize = true;
            this.lblMo_Ta.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMo_Ta.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
            this.lblMo_Ta.Location = new System.Drawing.Point(12, 260);
            this.lblMo_Ta.Name = "lblMo_Ta";
            this.lblMo_Ta.Size = new System.Drawing.Size(41, 14);
            this.lblMo_Ta.TabIndex = 116;
            this.lblMo_Ta.Text = "I. Mô tả";
            // 
            // txtMo_Ta
            // 
            this.txtMo_Ta.CheckTextSearched = false;
            this.txtMo_Ta.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtMo_Ta.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMo_Ta.Location = new System.Drawing.Point(99, 258);
            this.txtMo_Ta.MaxLength = 128;
            this.txtMo_Ta.Multiline = true;
            this.txtMo_Ta.Name = "txtMo_Ta";
            this.txtMo_Ta.OldValue = null;
            this.txtMo_Ta.Size = new System.Drawing.Size(683, 69);
            this.txtMo_Ta.TabIndex = 14;
            this.txtMo_Ta.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemDescription;
            this.txtMo_Ta.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtMo_Ta.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            // 
            // txtHien_Trang
            // 
            this.txtHien_Trang.CheckTextSearched = false;
            this.txtHien_Trang.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtHien_Trang.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtHien_Trang.Location = new System.Drawing.Point(99, 328);
            this.txtHien_Trang.MaxLength = 128;
            this.txtHien_Trang.Multiline = true;
            this.txtHien_Trang.Name = "txtHien_Trang";
            this.txtHien_Trang.OldValue = null;
            this.txtHien_Trang.Size = new System.Drawing.Size(683, 69);
            this.txtHien_Trang.TabIndex = 15;
            this.txtHien_Trang.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemDescription;
            this.txtHien_Trang.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtHien_Trang.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            // 
            // lblHien_Trang
            // 
            this.lblHien_Trang.AutoSize = true;
            this.lblHien_Trang.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblHien_Trang.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
            this.lblHien_Trang.Location = new System.Drawing.Point(12, 331);
            this.lblHien_Trang.Name = "lblHien_Trang";
            this.lblHien_Trang.Size = new System.Drawing.Size(55, 14);
            this.lblHien_Trang.TabIndex = 118;
            this.lblHien_Trang.Text = "II. Đề xuất";
            // 
            // lblIs_Stop0
            // 
            this.lblIs_Stop0.AutoSize = true;
            this.lblIs_Stop0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblIs_Stop0.ForeColor = System.Drawing.Color.Blue;
            this.lblIs_Stop0.Location = new System.Drawing.Point(125, 425);
            this.lblIs_Stop0.Name = "lblIs_Stop0";
            this.lblIs_Stop0.Size = new System.Drawing.Size(323, 14);
            this.lblIs_Stop0.TabIndex = 122;
            this.lblIs_Stop0.Text = "C-Chưa xử lý, G-Gửi bảo hành, S-Tự sửa chữa, T-Thuê sửa chữa";
            // 
            // txtHinh_Thuc
            // 
            this.txtHinh_Thuc.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtHinh_Thuc.CheckTextSearched = false;
            this.txtHinh_Thuc.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtHinh_Thuc.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtHinh_Thuc.InputMask = "C,G,S,T";
            this.txtHinh_Thuc.Location = new System.Drawing.Point(99, 421);
            this.txtHinh_Thuc.Name = "txtHinh_Thuc";
            this.txtHinh_Thuc.OldValue = null;
            this.txtHinh_Thuc.Size = new System.Drawing.Size(23, 20);
            this.txtHinh_Thuc.TabIndex = 20;
            this.txtHinh_Thuc.Text = "C";
            this.txtHinh_Thuc.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtHinh_Thuc.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtHinh_Thuc.Value = "C";
            // 
            // lblIs_Stop
            // 
            this.lblIs_Stop.AutoSize = true;
            this.lblIs_Stop.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblIs_Stop.Location = new System.Drawing.Point(12, 423);
            this.lblIs_Stop.Name = "lblIs_Stop";
            this.lblIs_Stop.Size = new System.Drawing.Size(53, 14);
            this.lblIs_Stop.TabIndex = 121;
            this.lblIs_Stop.Text = "Hình thức";
            // 
            // txtTen_Kt
            // 
            this.txtTen_Kt.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Kt.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_Kt.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Kt.CheckTextSearched = false;
            this.txtTen_Kt.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Kt.Enabled = false;
            this.txtTen_Kt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Kt.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Kt.Location = new System.Drawing.Point(223, 446);
            this.txtTen_Kt.Name = "txtTen_Kt";
            this.txtTen_Kt.OldValue = null;
            this.txtTen_Kt.Size = new System.Drawing.Size(172, 13);
            this.txtTen_Kt.TabIndex = 22;
            this.txtTen_Kt.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.txtTen_Kt.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Kt.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            // 
            // txtMa_Kt
            // 
            this.txtMa_Kt.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Kt.CheckTextSearched = false;
            this.txtMa_Kt.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Kt.EmptyIsValid = true;
            this.txtMa_Kt.FieldDisplay = "Ten_Dt";
            this.txtMa_Kt.FirstFilter = "Is_Stop = \'1\'";
            this.txtMa_Kt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Kt.Location = new System.Drawing.Point(99, 443);
            this.txtMa_Kt.MaxLength = 32;
            this.txtMa_Kt.Name = "txtMa_Kt";
            this.txtMa_Kt.OldValue = null;
            this.txtMa_Kt.Size = new System.Drawing.Size(118, 20);
            this.txtMa_Kt.TabIndex = 21;
            this.txtMa_Kt.TableName = "DMDT";
            this.txtMa_Kt.TextDisplay = this.txtTen_Kt;
            this.txtMa_Kt.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Kt.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Kt.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            // 
            // lblMa_Kt
            // 
            this.lblMa_Kt.AutoSize = true;
            this.lblMa_Kt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Kt.Location = new System.Drawing.Point(12, 446);
            this.lblMa_Kt.Name = "lblMa_Kt";
            this.lblMa_Kt.Size = new System.Drawing.Size(86, 14);
            this.lblMa_Kt.TabIndex = 125;
            this.lblMa_Kt.Text = "Người sửa chữa";
            // 
            // lblNgay_Ht
            // 
            this.lblNgay_Ht.AutoSize = true;
            this.lblNgay_Ht.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblNgay_Ht.Location = new System.Drawing.Point(409, 443);
            this.lblNgay_Ht.Name = "lblNgay_Ht";
            this.lblNgay_Ht.Size = new System.Drawing.Size(127, 14);
            this.lblNgay_Ht.TabIndex = 126;
            this.lblNgay_Ht.Text = "Ngày dự kiến hoàn thành";
            // 
            // txtNgay_Ht
            // 
            this.txtNgay_Ht.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.txtNgay_Ht.DateTimeFormat = SmartSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ht.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNgay_Ht.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtNgay_Ht.Location = new System.Drawing.Point(533, 437);
            this.txtNgay_Ht.Mask = "00/00/0000";
            this.txtNgay_Ht.Name = "txtNgay_Ht";
            this.txtNgay_Ht.OldValue = null;
            this.txtNgay_Ht.Size = new System.Drawing.Size(71, 20);
            this.txtNgay_Ht.TabIndex = 127;
            this.txtNgay_Ht.Value = global::SmartSoft.ReportForms.FormVTH02BViewer.txtTen_Nh_Vt_Value;
            // 
            // Column3
            // 
            this.Column3.DataPropertyName = "Ma_Ts";
            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.BottomLeft;
            this.Column3.DefaultCellStyle = dataGridViewCellStyle1;
            this.Column3.DestinationFields = "Ten_Ts";
            this.Column3.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column3.FirstFilter = "Loai_Ts = \'C\'";
            this.Column3.HeaderText = "Mã tài sản";
            this.Column3.MinimumWidth = 100;
            this.Column3.Name = "Column3";
            this.Column3.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.Column3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column3.SourceFields = "Ten_Ts";
            this.Column3.TableName = "DMTS";
            this.Column3.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.Column3.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            // 
            // Column4
            // 
            this.Column4.DataPropertyName = "Ten_Ts";
            this.Column4.HeaderText = "Tên tài sản";
            this.Column4.MinimumWidth = 140;
            this.Column4.Name = "Column4";
            this.Column4.ReadOnly = true;
            this.Column4.Width = 140;
            // 
            // So_Hieu
            // 
            this.So_Hieu.DataPropertyName = "So_Hieu";
            this.So_Hieu.HeaderText = "Số Serial";
            this.So_Hieu.Name = "So_Hieu";
            // 
            // Column9
            // 
            this.Column9.DataPropertyName = "Ma_Vt";
            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column9.DefaultCellStyle = dataGridViewCellStyle2;
            this.Column9.DestinationFields = "Ten_Vt, Dvt";
            this.Column9.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column9.EmptyIsValid = true;
            this.Column9.HeaderText = "Mã phụ tùng";
            this.Column9.MinimumWidth = 100;
            this.Column9.Name = "Column9";
            this.Column9.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.Column9.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column9.SourceFields = "Ten_Vt, Dvt";
            this.Column9.TableName = "DMVT";
            this.Column9.UserTextLength = SmartSoft.AppInstance.TextControlLength.ItemCode;
            this.Column9.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            // 
            // Column10
            // 
            this.Column10.DataPropertyName = "Ten_Vt";
            this.Column10.HeaderText = "Tên phụ tùng";
            this.Column10.MinimumWidth = 140;
            this.Column10.Name = "Column10";
            this.Column10.ReadOnly = true;
            this.Column10.Width = 140;
            // 
            // Column11
            // 
            this.Column11.DataPropertyName = "Dvt";
            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column11.DefaultCellStyle = dataGridViewCellStyle3;
            this.Column11.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column11.HeaderText = "Đvt";
            this.Column11.MinimumWidth = 60;
            this.Column11.Name = "Column11";
            this.Column11.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.Column11.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column11.UserTextLength = SmartSoft.AppInstance.TextControlLength.None;
            this.Column11.UserTrimMode = SmartSoft.AppInstance.TextControlTrimMode.Right;
            this.Column11.Width = 60;
            // 
            // Column23
            // 
            this.Column23.DataPropertyName = "Ghi_Chu";
            this.Column23.HeaderText = "Mô tả";
            this.Column23.Name = "Column23";
            this.Column23.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.Column23.Width = 109;
            // 
            // Column22
            // 
            this.Column22.DataPropertyName = "So_Luong9";
            dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column22.DefaultCellStyle = dataGridViewCellStyle4;
            this.Column22.HeaderText = "Số lượng";
            this.Column22.MinimumWidth = 100;
            this.Column22.Name = "Column22";
            this.Column22.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column22.UserTextNumericFormat = SmartSoft.AppInstance.TextNumericFormat.Quantity;
            this.Column22.ZeroIsValid = true;
            // 
            // FormCTYCEditor
            // 
            this.ClientSize = new System.Drawing.Size(794, 532);
            this.Controls.Add(this.txtNgay_Ht);
            this.Controls.Add(this.lblNgay_Ht);
            this.Controls.Add(this.txtTen_Kt);
            this.Controls.Add(this.txtMa_Kt);
            this.Controls.Add(this.lblMa_Kt);
            this.Controls.Add(this.lblIs_Stop0);
            this.Controls.Add(this.txtHinh_Thuc);
            this.Controls.Add(this.lblIs_Stop);
            this.Controls.Add(this.txtHien_Trang);
            this.Controls.Add(this.lblHien_Trang);
            this.Controls.Add(this.txtMo_Ta);
            this.Controls.Add(this.lblMo_Ta);
            this.Controls.Add(this.txtTen_CvN);
            this.Controls.Add(this.txtMa_CvN);
            this.Controls.Add(this.lblMa_CvN);
            this.Controls.Add(this.txtTen_DtN);
            this.Controls.Add(this.txtMa_DtN);
            this.Controls.Add(this.lblMa_DtN);
            this.Controls.Add(this.txtTen_CvX);
            this.Controls.Add(this.txtMa_CvX);
            this.Controls.Add(this.lblMa_Cv);
            this.Controls.Add(this.txtDia_Chi);
            this.Controls.Add(this.txtTen_Dt);
            this.Controls.Add(this.txtMa_Dt);
            this.Controls.Add(this.lblDia_Chi);
            this.Controls.Add(this.lblMa_Dt);
            this.Controls.Add(this.txtDesc_EN);
            this.Controls.Add(this.txtGhi_Chu);
            this.Controls.Add(this.txtDien_Giai);
            this.Controls.Add(this.lblGhi_Chu);
            this.Controls.Add(this.lblDesc_EN);
            this.Controls.Add(this.lblDien_Giai);
            this.Controls.Add(this.grdDetail);
            this.Name = "FormCTYCEditor";
            this.Controls.SetChildIndex(this.grdDetail, 0);
            this.Controls.SetChildIndex(this.lblPhan_Loai, 0);
            this.Controls.SetChildIndex(this.txtSo_Ct, 0);
            this.Controls.SetChildIndex(this.txtNgay_Ps, 0);
            this.Controls.SetChildIndex(this.txtNgay_Ct, 0);
            this.Controls.SetChildIndex(this.txtMa_Loai1, 0);
            this.Controls.SetChildIndex(this.txtMa_Loai2, 0);
            this.Controls.SetChildIndex(this.txtMa_Loai3, 0);
            this.Controls.SetChildIndex(this.lblDien_Giai, 0);
            this.Controls.SetChildIndex(this.lblDesc_EN, 0);
            this.Controls.SetChildIndex(this.lblGhi_Chu, 0);
            this.Controls.SetChildIndex(this.txtDien_Giai, 0);
            this.Controls.SetChildIndex(this.txtGhi_Chu, 0);
            this.Controls.SetChildIndex(this.txtDesc_EN, 0);
            this.Controls.SetChildIndex(this.lblMa_Dt, 0);
            this.Controls.SetChildIndex(this.lblDia_Chi, 0);
            this.Controls.SetChildIndex(this.txtMa_Dt, 0);
            this.Controls.SetChildIndex(this.txtTen_Dt, 0);
            this.Controls.SetChildIndex(this.txtDia_Chi, 0);
            this.Controls.SetChildIndex(this.lblMa_Cv, 0);
            this.Controls.SetChildIndex(this.txtMa_CvX, 0);
            this.Controls.SetChildIndex(this.txtTen_CvX, 0);
            this.Controls.SetChildIndex(this.lblMa_DtN, 0);
            this.Controls.SetChildIndex(this.txtMa_DtN, 0);
            this.Controls.SetChildIndex(this.txtTen_DtN, 0);
            this.Controls.SetChildIndex(this.lblMa_CvN, 0);
            this.Controls.SetChildIndex(this.txtMa_CvN, 0);
            this.Controls.SetChildIndex(this.txtTen_CvN, 0);
            this.Controls.SetChildIndex(this.lblMo_Ta, 0);
            this.Controls.SetChildIndex(this.txtMo_Ta, 0);
            this.Controls.SetChildIndex(this.lblHien_Trang, 0);
            this.Controls.SetChildIndex(this.txtHien_Trang, 0);
            this.Controls.SetChildIndex(this.lblIs_Stop, 0);
            this.Controls.SetChildIndex(this.txtHinh_Thuc, 0);
            this.Controls.SetChildIndex(this.lblIs_Stop0, 0);
            this.Controls.SetChildIndex(this.lblMa_Kt, 0);
            this.Controls.SetChildIndex(this.txtMa_Kt, 0);
            this.Controls.SetChildIndex(this.txtTen_Kt, 0);
            this.Controls.SetChildIndex(this.lblNgay_Ht, 0);
            this.Controls.SetChildIndex(this.txtNgay_Ht, 0);
            ((System.ComponentModel.ISupportInitialize)(this.grdDetail)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        internal override void OnAdd()
        {
            object obj2 = base.LocalMasterRow["So_Ct"];
            base.LocalMasterRow = base.MakeMasterRow();
            base.LocalMasterRow["Nh_Ct"] = base.SSInvoiceParameters.InvoiceType;
            base.LocalMasterRow["So_Ct"] = this.oMethod.Cong_So_Ct(AppInstance.Subsidiary, base.InvoiceCode, base.LocalMasterRow["Ngay_Ct"], obj2);
            base.LocalMasterRow["Hinh_Thuc"] = "C";
            base.MakeDetailTable();
            base.LocalDetailTable.Rows[0]["Stt_Nv"] = 1;
            base.LocalDetailTable.Rows[0]["He_So9"] = 1;
            base.LocalDetailTable.Rows[0]["So_Luong9"] = 0;
            base.LocalDetailTable.Rows[0]["So_Luong"] = 0;
            base.LocalDetailTable.Rows[0]["H_Luong"] = 0;
            base.LocalDetailTable.Rows[0]["Do_Am_PT"] = 0;
            base.LocalDetailTable.Rows[0]["Do_Con_PT"] = 0;
            base.OnAdd();
        }

        internal override void OnCopy()
        {
            object obj2 = base.LocalMasterRow["So_Ct"];
            base.LocalMasterRow["So_Ct"] = this.oMethod.Cong_So_Ct(AppInstance.Subsidiary, base.InvoiceCode, base.LocalMasterRow["Ngay_Ct"], obj2);
            base.OnCopy();
        }

        internal override void OnResetControls()
        {
            base.DetailGridBrowser = this.grdDetail;
            int num = 0;
            if (!base.SSInvoiceParameters.BilingualUsed)
            {
                this.lblDesc_EN.Visible = false;
                this.txtDesc_EN.Visible = false;
                this.txtDien_Giai.Width = (this.txtDesc_EN.Left + this.txtDesc_EN.Width) - this.txtDien_Giai.Left;
                this.txtDien_Giai.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            }
            //if (!AppInstance.LocationCtrl)
            //{
            //    base.DetailGridBrowser.Columns[6].Visible = false;
            //}
            //if (!AppInstance.LotNumberCtrl)
            //{
            //    base.DetailGridBrowser.Columns[7].Visible = false;
            //}
            //if (!AppInstance.DeadLineCtrl)
            //{
            //    base.DetailGridBrowser.Columns[8].Visible = false;
            //}
            //if (!AppInstance.QualityCtrl)
            //{
            //    base.DetailGridBrowser.Columns[9].Visible = false;
            //}
            //if (!AppInstance.DampCtrl)
            //{
            //    base.DetailGridBrowser.Columns[10].Visible = false;
            //}
            //if (!AppInstance.AlcoholCtrl)
            //{
            //    base.DetailGridBrowser.Columns[11].Visible = false;
            //}
            //if (!AppInstance.LocationCtrl || (base.InvoiceCode != "PWDC"))
            //{
            //    base.DetailGridBrowser.Columns[12].Visible = false;
            //}

            //if (!AppInstance.LocationCtrl)
            //{
            //    base.DetailGridBrowser.Columns[4].Visible = false;
            //}
            //if (!AppInstance.LotNumberCtrl)
            //{
            //    base.DetailGridBrowser.Columns[5].Visible = false;
            //}
            //if (!AppInstance.DeadLineCtrl)
            //{
            //    base.DetailGridBrowser.Columns[6].Visible = false;
            //}
            //if (!AppInstance.QualityCtrl)
            //{
            //    base.DetailGridBrowser.Columns[7].Visible = false;
            //}
            //if (!AppInstance.DampCtrl)
            //{
            //    base.DetailGridBrowser.Columns[8].Visible = false;
            //}
            //if (!AppInstance.AlcoholCtrl)
            //{
            //    base.DetailGridBrowser.Columns[9].Visible = false;
            //}
            //if (!AppInstance.LocationCtrl || (base.InvoiceCode != "PWDC"))
            //{
            //    base.DetailGridBrowser.Columns[10].Visible = false;
            //}
            //if (base.SSInvoiceParameters.FreeFields <= 0)
            //{
            //    num = base.txtMa_Loai1.Top - this.txtGhi_Chu.Top;
                //this.lblMa_KhoN.Top += num;
                //this.txtMa_KhoN.Top += num;
                //this.txtTen_KhoN.Top += num;
            //    this.lblGhi_Chu.Top += num;
            //    this.txtGhi_Chu.Top += num;
            //    base.DetailGridBrowser.Height += num;
            //}
            //if (base.InvoiceCode != "PWDC")
            //{
            //    num = this.txtGhi_Chu.Top - this.txtMa_KhoN.Top;
            //    this.lblMa_KhoN.Visible = false;
            //    this.txtMa_KhoN.Visible = false;
            //    this.txtTen_KhoN.Visible = false;
            //    base.DetailGridBrowser.Height += num;
            //}
            if (base.SSInvoiceParameters.InvoiceType == "2")
            {
                //(base.DetailGridBrowser.Columns[7] as SearchLotNumberColumn).TableName = "LOHANG";
                //base.DetailGridBrowser.Columns[8].ReadOnly = true;
                //base.DetailGridBrowser.Columns[9].ReadOnly = true;
                //base.DetailGridBrowser.Columns[10].ReadOnly = true;
                //base.DetailGridBrowser.Columns[11].ReadOnly = true;

                //(base.DetailGridBrowser.Columns[5] as SearchLotNumberColumn).TableName = "LOHANG";
                //base.DetailGridBrowser.Columns[6].ReadOnly = true;
                //base.DetailGridBrowser.Columns[7].ReadOnly = true;
                //base.DetailGridBrowser.Columns[8].ReadOnly = true;
                //base.DetailGridBrowser.Columns[9].ReadOnly = true;
            }
            else
            {
                //(base.DetailGridBrowser.Columns[7] as SearchLotNumberColumn).TableName = "";
                //(base.DetailGridBrowser.Columns[5] as SearchLotNumberColumn).TableName = "";
            }
            base.OnResetControls();
        }

        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);
            //if (this.txtOng_Ba != null)
            //{
            //    //int num = base.ClientSize.Width - 0xcb;
            //    //this.txtOng_Ba.Width = num / 2;
            //    //this.txtDia_Chi.Left = (this.txtOng_Ba.Left + this.txtOng_Ba.Width) + 0x5c;
            //    //this.txtDia_Chi.Width = num - this.txtOng_Ba.Width;
            //    //this.lblDia_Chi.Left = (this.txtDia_Chi.Left - this.lblDia_Chi.Width) - 6;
            //    if ((base.SSInvoiceParameters != null) && base.SSInvoiceParameters.BilingualUsed)
            //    {
            //        //this.txtDien_Giai.Width = this.txtOng_Ba.Width;
            //        this.txtDesc_EN.Left = this.txtDia_Chi.Left;
            //        this.txtDesc_EN.Width = this.txtDia_Chi.Width;
            //        this.lblDesc_EN.Left = (this.txtDesc_EN.Left - this.lblDesc_EN.Width) - 6;
            //    }
            //}
        }

        protected override bool OnSave()
        {
            if (base.txtNgay_Ps.Value == SDBNull.Value)
            {
                MessageBox.Show("Chưa nhập ngày phát sinh!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (base.txtNgay_Ct.Value == SDBNull.Value)
            {
                MessageBox.Show("Chưa nhập ngày chứng từ!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (((DateTime) base.txtNgay_Ct.Value) < AppInstance.OpeningDateOfSubEnterprice)
            {
                MessageBox.Show("Ngày chứng từ phải từ ngày " + AppInstance.OpeningDateOfSubEnterprice.ToShortDateString(), AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (((DateTime) base.txtNgay_Ct.Value) <= AppInstance.EndingDateOfSubEnterprice)
            {
                MessageBox.Show("Ngày chứng từ phải từ ngày " + AppInstance.EndingDateOfSubEnterprice.AddDays(1.0).ToShortDateString(), AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            foreach (DataRow row in base.LocalDetailTable.Rows)
            {
                if ((row.RowState != DataRowState.Deleted) && string.IsNullOrEmpty(row["Ma_Ts"].ToString()))
                {
                    MessageBox.Show("Không được để mã tài sản trống!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    return false;
                }
            }
            if (!base.CheckNewRow)
            {
                int num = this.oMethod.CheckInvoiceStatus(AppInstance.Subsidiary, AppInstance.UserName, base.SavedMasterOrder);
                switch (num)
                {
                    case 9:
                    case 7:
                        break;

                    default:
                        if ((base.SSInvoiceParameters.AllowPostInvoice && base.SSInvoiceParameters.AllowLockInvoice) || ((num != 6) && (num != 5)))
                        {
                            if (num == 8)
                            {
                                base.SSInvoiceParameters.ShowInvoiceUsed(base.SavedMasterOrder, base.SSInvoiceParameters.StatusMessage(num));
                                return false;
                            }
                            goto Label_01F4;
                        }
                        break;
                }
                MessageBox.Show(base.SSInvoiceParameters.StatusMessage(num), AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
        Label_01F4:
            if (this.oMethod.NumberExisted(AppInstance.Subsidiary, base.CheckNewRow, base.SavedMasterOrder, base.InvoiceCode, base.txtNgay_Ct.Value, base.txtSo_Ct.Value) && (MessageBox.Show("Số chứng từ đã tồn tại. C\x00f3 tiếp tục không?", AppInstance.SoftwareName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No))
            {
                if (MessageBox.Show("Có muốn tự động tạo số chứng từ không?", AppInstance.SoftwareName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                {
                    return false;
                }
                object obj2 = base.txtSo_Ct.Value;
                base.txtSo_Ct.Value = this.oMethod.Cong_So_Ct(AppInstance.Subsidiary, base.InvoiceCode, base.LocalMasterRow["Ngay_Ct"], obj2);
            }
            base.DetailGridBrowser.EndEdit();
            base.LocalMasterRow["Ngay_Ps"] = base.txtNgay_Ps.Value;
            base.LocalMasterRow["Ngay_Ct"] = base.txtNgay_Ct.Value;
            base.LocalMasterRow["So_Ct"] = base.txtSo_Ct.Value;
            base.LocalMasterRow["Ma_Dt"] = this.txtMa_Dt.Value;
            base.LocalMasterRow["Ten_Dt"] = this.txtTen_Dt.Value;
            base.LocalMasterRow["Ma_CvX"] = this.txtMa_CvX.Value;
            base.LocalMasterRow["Ten_CvX"] = this.txtTen_CvX.Value;
            base.LocalMasterRow["Ten_CvX"] = this.txtTen_CvX.Value; 
            base.LocalMasterRow["Dia_Chi"] = this.txtDia_Chi.Value;
            base.LocalMasterRow["Dien_Giai"] = this.txtDien_Giai.Value;
            base.LocalMasterRow["Desc_EN"] = this.txtDesc_EN.Value;
            base.LocalMasterRow["Mo_Ta"] = this.txtMo_Ta.Value;
            base.LocalMasterRow["Hien_Trang"] = this.txtHien_Trang.Value;
            base.LocalMasterRow["Ma_DtN"] = this.txtMa_DtN.Value;
            base.LocalMasterRow["Ten_DtN"] = this.txtTen_DtN.Value;
            base.LocalMasterRow["Ma_CvN"] = this.txtMa_CvN.Value;
            base.LocalMasterRow["Ten_CvN"] = this.txtTen_CvN.Value;
            base.LocalMasterRow["Hinh_Thuc"] = this.txtHinh_Thuc.Value;
            base.LocalMasterRow["Ma_Kt"] = this.txtMa_Kt.Value;
            base.LocalMasterRow["Ten_Kt"] = this.txtTen_Kt.Value;
            base.LocalMasterRow["Ngay_Ht"] = this.txtNgay_Ht.Value;
            base.LocalMasterRow["Ghi_Chu"] = this.txtGhi_Chu.Value;
            base.LocalMasterRow["Ma_Loai1"] = base.txtMa_Loai1.Value;
            base.LocalMasterRow["Ma_Loai2"] = base.txtMa_Loai2.Value;
            base.LocalMasterRow["Ma_Loai3"] = base.txtMa_Loai3.Value;
            return (this.oMethod.Save(base.SSInvoiceParameters.InvoiceHistory, base.CheckNewRow, AppInstance.Subsidiary, AppInstance.UserName, base.LocalMasterRow, base.LocalDetailTable) && base.OnSave());
        }

        internal override void OnShow()
        {
            base.OnShow();
            this.txtMa_Dt.Value = base.LocalMasterRow["Ma_Dt"];
            this.txtTen_Dt.Value = base.LocalMasterRow["Ten_Dt"];
            this.txtMa_CvX.Value = base.LocalMasterRow["Ma_CvX"];
            this.txtTen_CvX.Value = base.LocalMasterRow["Ten_CvX"];
            this.txtDia_Chi.Value = base.LocalMasterRow["Dia_Chi"];
            this.txtDien_Giai.Value = base.LocalMasterRow["Dien_Giai"];
            this.txtDesc_EN.Value = base.LocalMasterRow["Desc_EN"];
            this.txtMo_Ta.Value = base.LocalMasterRow["Mo_Ta"];
            this.txtHien_Trang.Value = base.LocalMasterRow["Hien_Trang"];
            this.txtMa_DtN.Value = base.LocalMasterRow["Ma_DtN"];
            this.txtTen_DtN.Value = base.LocalMasterRow["Ten_DtN"];
            this.txtMa_CvN.Value = base.LocalMasterRow["Ma_CvN"];
            this.txtTen_CvN.Value = base.LocalMasterRow["Ten_CvN"];
            this.txtHinh_Thuc.Value = base.LocalMasterRow["Hinh_Thuc"];
            this.txtNgay_Ht.Value = base.LocalMasterRow["Ngay_Ht"];
            this.txtGhi_Chu.Value = base.LocalMasterRow["Ghi_Chu"];
        }

        private void SetItemRatio()
        {
            DataRow row = ((DataRowView) base.DetailGridBrowser.CurrentRow.DataBoundItem).Row;
            DataRow row2 = SSDataAccess.SelectDataRow(false, "DMVT", "Ma_Vt", row["Ma_Vt"].ToString(), null);
            if (row2 != null)
            {
                if (row["Dvt"].Equals(row2["Dvt"]))
                {
                    row["He_So9"] = 1;
                }
                else if (row["Dvt"].Equals(row2["Dvt0"]))
                {
                    row["He_So9"] = row2["He_So0"];
                }
                else if (row["Dvt"].Equals(row2["Dvt1"]))
                {
                    row["He_So9"] = row2["He_So1"];
                }
                else if (row["Dvt"].Equals(row2["Dvt2"]))
                {
                    row["He_So9"] = row2["He_So2"];
                }
                row.EndEdit();
                this.Calculate();
            }
        }

        private void SetItemUnits()
        {
            DataRow row = ((DataRowView) base.DetailGridBrowser.CurrentRow.DataBoundItem).Row;
            DataRow row2 = SSDataAccess.SelectDataRow(false, "DMVT", "Ma_Vt", row["Ma_Vt"].ToString(), null);
            if (row2 != null)
            {
                if (string.IsNullOrEmpty(row2["Dvt0"].ToString()))
                {
                    base.DetailGridBrowser.CurrentCell.ReadOnly = true;
                }
                else
                {
                    string str = (string.IsNullOrEmpty(row2["Dvt"].ToString()) ? "" : row2["Dvt"].ToString()) + (string.IsNullOrEmpty(row2["Dvt0"].ToString()) ? "" : ("," + row2["Dvt0"].ToString())) + (string.IsNullOrEmpty(row2["Dvt1"].ToString()) ? "" : ("," + row2["Dvt1"].ToString())) + (string.IsNullOrEmpty(row2["Dvt2"].ToString()) ? "" : ("," + row2["Dvt2"].ToString())) + (string.IsNullOrEmpty(row2["Dvt3"].ToString()) ? "" : ("," + row2["Dvt3"].ToString()));
                    (base.DetailGridBrowser.CurrentCell as OptionCell).InputMask = str;
                    base.DetailGridBrowser.CurrentCell.ReadOnly = false;
                }
            }
        }

        private void txtMa_Dt_Validated(object sender, EventArgs e)
        {
            if (this.txtMa_Dt.ValueChanged)
            {
                //this.txtOng_Ba.Value = this.txtMa_Dt.GetFieldData("Doi_Tac").Equals(DBNull.Value) ? this.txtTen_Dt.Value : this.txtMa_Dt.GetFieldData("Doi_Tac");
                this.txtDia_Chi.Value = this.txtMa_Dt.GetFieldData("Dia_Chi");
                this.txtMa_CvX.Value = this.txtMa_Dt.GetFieldData("Ma_Cv");
            }
        }
    }
}

